home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / intuition / printitext.c < prev    next >
C/C++ Source or Header  |  1996-11-08  |  3KB  |  137 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: printitext.c,v 1.6 1996/11/08 11:28:04 aros Exp $
  4.     $Log: printitext.c,v $
  5.     Revision 1.6  1996/11/08 11:28:04  aros
  6.     All OS function use now Amiga types
  7.  
  8.     Moved intuition-driver protos to intuition_intern.h
  9.  
  10.     Revision 1.5  1996/10/24 15:51:23  aros
  11.     Use the official AROS macros over the __AROS versions.
  12.  
  13.     Revision 1.4  1996/10/21 17:07:08  aros
  14.     Restored wrong font
  15.  
  16.     Revision 1.3  1996/08/29 15:13:32  digulla
  17.     Wrote code
  18.  
  19.     Revision 1.2  1996/08/29 13:57:37  digulla
  20.     Commented
  21.     Moved common code from driver to Intuition
  22.  
  23.     Revision 1.1  1996/08/23 17:28:18  digulla
  24.     Several new functions; some still empty.
  25.  
  26.  
  27.     Desc:
  28.     Lang: english
  29. */
  30. #include "intuition_intern.h"
  31. #include <string.h>
  32. #include <clib/graphics_protos.h>
  33.  
  34. /*****************************************************************************
  35.  
  36.     NAME */
  37.     #include <graphics/rastport.h>
  38.     #include <intuition/intuition.h>
  39.     #include <clib/intuition_protos.h>
  40.  
  41.     AROS_LH4(void, PrintIText,
  42.  
  43. /*  SYNOPSIS */
  44.     AROS_LHA(struct RastPort  *, rp, A0),
  45.     AROS_LHA(struct IntuiText *, iText, A1),
  46.     AROS_LHA(LONG              , leftOffset, D0),
  47.     AROS_LHA(LONG              , topOffset, D1),
  48.  
  49. /*  LOCATION */
  50.     struct IntuitionBase *, IntuitionBase, 36, Intuition)
  51.  
  52. /*  FUNCTION
  53.     Render an IntuiText in the specified RastPort with the
  54.     specified offset.
  55.  
  56.     INPUTS
  57.     rp - Draw into this RastPort
  58.     iText - Render this text
  59.     leftOffset, topOffset - Starting-Point. All coordinates in the
  60.         IntuiText structures are relative to this point.
  61.  
  62.     RESULT
  63.     None.
  64.  
  65.     NOTES
  66.  
  67.     EXAMPLE
  68.  
  69.     BUGS
  70.  
  71.     SEE ALSO
  72.  
  73.     INTERNALS
  74.  
  75.     HISTORY
  76.     29-10-95    digulla automatically created from
  77.                 intuition_lib.fd and clib/intuition_protos.h
  78.  
  79. *****************************************************************************/
  80. {
  81.     AROS_LIBFUNC_INIT
  82.     AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
  83.     ULONG  apen;
  84.     ULONG  bpen;
  85.     ULONG  drmd;
  86.     struct TextFont * font;
  87.     struct TextFont * newfont;
  88.  
  89.     /* Store important variables of the RastPort */
  90.     apen = GetAPen (rp);
  91.     bpen = GetBPen (rp);
  92.     drmd = GetDrMd (rp);
  93.  
  94.     font = rp->Font;
  95.  
  96.     /* For all borders... */
  97.     for ( ; iText; iText=iText->NextText)
  98.     {
  99.     /* Change RastPort to the colors/mode specified */
  100.     SetAPen (rp, iText->FrontPen);
  101.     SetBPen (rp, iText->BackPen);
  102.     SetDrMd (rp, iText->DrawMode);
  103.  
  104.     if (iText->ITextFont)
  105.     {
  106.         newfont = OpenFont (iText->ITextFont);
  107.  
  108.         if (newfont)
  109.         SetFont (rp, newfont);
  110.     }
  111.  
  112.     /* Move to initial position */
  113.     Move (rp
  114.         , iText->LeftEdge + leftOffset
  115.         , iText->TopEdge + topOffset
  116.     );
  117.     Text (rp, iText->IText, strlen (iText->IText));
  118.  
  119.     if (iText->ITextFont)
  120.     {
  121.         if (newfont)
  122.         {
  123.         SetFont (rp, font);
  124.         CloseFont (newfont);
  125.         }
  126.     }
  127.     }
  128.  
  129.     /* Restore RastPort */
  130.     SetAPen (rp, apen);
  131.     SetBPen (rp, bpen);
  132.     SetDrMd (rp, drmd);
  133.     SetFont (rp, font);
  134.  
  135.     AROS_LIBFUNC_EXIT
  136. } /* PrintIText */
  137.